<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<table id="tableID" border="1" cellspacing="0" cellpadding="10px">
			<tr>
				<th></th>
				<th>姓名</th>
				<th>性别</th>
				<th>年龄</th>
				<th>家庭住址</th>
			</tr>
			<tr>
				<td><input type="checkbox" name="stu" id="" value="1" /></td>
				<td>张三1</td>
				<td>男</td>
				<td>19</td>
				<td>福建省新罗区</td>
			</tr>
			<tr>
				<td><input type="checkbox" name="stu" id="" value="2" /></td>
				<td>张三2</td>
				<td>男</td>
				<td>19</td>
				<td>福建省新罗区</td>
			</tr>
			<tr>
				<td><input type="checkbox" name="stu" id="" value="3" /></td>
				<td>张三3</td>
				<td>男</td>
				<td>19</td>
				<td>福建省新罗区</td>
			</tr>
			<tr>
				<td><input type="checkbox" name="stu" id="" value="4" /></td>
				<td>张三4</td>
				<td>男</td>
				<td>19</td>
				<td>福建省新罗区</td>
			</tr>
			<tr>
				<td><input type="checkbox" name="stu1" id="" value="5" /></td>
				<td>张三5</td>
				<td>女</td>
				<td>19</td>
				<td>福建省新罗区</td>
			</tr>
		</table>
		<input type="checkbox" name="" id="checkAll1" value="" onclick="check()"/>全选
		<input type="checkbox" name="" id="checkAll2" value="" onclick="checkman()"/>全选男
		<input type="checkbox" name="" id="checkAll3" value="" onclick="checkwoman()"/>全选女
		<button type="submit" >取消</button>
		
	</body>
	<script type="text/javascript">
		function check(){
			var tableOjb=document.getElementById('tableID');
			var allsell =tableOjb.getElementsByTagName('input');
			var checkallvalue=document.getElementById('checkAll1');
			for(var i=0;i<allsell.length;i++){
							allsell[i].checked = checkallvalue.checked;
						}
		}
		function checkman(){
			var tableOjb=document.getElementById('tableID');
			var allsell2 =tableOjb.getElementsByTagName('input');
			var checkallvalue2=document.getElementById('checkAll2');
			for(var i=0;i<allsell2.length;i++){
				if(allsell2[i].name=='stu'){
							allsell2[i].checked = checkallvalue2.checked;
						}
						}
			
		}
		function checkwoman(){
		var tableOjb=document.getElementById('tableID');
		var allsell3 =tableOjb.getElementsByTagName('input');
		var checkallvalue3=document.getElementById('checkAll3');
		for(var i=0;i<allsell3.length;i++){
					if(allsell3[i].name=="stu1"){
						allsell3[i].checked = checkallvalue3.checked;
					}
					}
		}
		
		
	</script>
</html>
